home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / timeval_md.h < prev    next >
C/C++ Source or Header  |  1998-09-15  |  1KB  |  40 lines

  1. /*
  2.  * @(#)timeval_md.h    1.7 98/07/01
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. #ifndef    _WIN32_TIMEVAL_H_
  16. #define    _WIN32_TIMEVAL_H_
  17.  
  18. typedef struct {
  19.     long tv_sec;
  20.     long tv_usec;
  21. } timeval_t;
  22.  
  23. /*
  24.  * Operations on timevals.
  25.  *
  26.  * NB: timercmp does not work for >=, <= or ==.
  27.  */
  28. #define timerisset(tvp)         ((tvp)->tv_sec || (tvp)->tv_usec)
  29. #define timercmp(tvp, uvp, cmp) \
  30.         ((tvp)->tv_sec cmp (uvp)->tv_sec || \
  31.          (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
  32. #define timereq(tvp, uvp) \
  33.          ((tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec == (uvp)->tv_usec)
  34. #define timerclear(tvp)         (tvp)->tv_sec = (tvp)->tv_usec = 0
  35.  
  36. void timeradd(timeval_t*, timeval_t*);
  37. void timersub(timeval_t*, timeval_t*);
  38.  
  39. #endif /* !_WIN32_TIMEVAL_H_ */
  40.